import os
import configparser

#ini文件操作类
class Conf():
    def __init__(self, file):
        self.iniFile = file

        if not os.path.exists(self.iniFile):
          with open(self.iniFile, "w", encoding="utf-8") as f:
              f.close()
    
        conf = configparser.ConfigParser()
        conf.read(self.iniFile)
        self.conf = conf
    #写文件
    def write(self, key1, key2, value):
        if self.conf.has_section(key1) == False:
            self.conf.add_section(key1)
        self.conf.set(key1, key2, value)
        self.conf.write(open(self.iniFile, "w", encoding="utf-8"))

        
    # 读取
    def read(self, key1, key2):
        if self.conf.has_section(key1) == False:
            self.conf.add_section(key1)
            return ""
        try:
            return self.conf.get(key1, key2)
        except:
            return ""
        
        

# 分离数组，按照长度
def split_array_with_length(ids):
    arr_len6 = []
    arr_len5 = []
    for item in ids:
        if len(item) == 5:
            arr_len5.append(item)
        else:
            arr_len6.append(item)
    return arr_len5, arr_len6
